import { http } from '@/utils/http/axios';

/**
 * @description: 部门列表
 */
export function deptList(data) {
  return http.request({
    url: '/depts/search',
    method: 'post',
    data,
  });
}

/**
 * @description: 部门树形列表
 */
export function deptsTreeList(params?) {
  return http.request({
    url: '/depts/tree',
    method: 'get',
    params,
  });
}

/**
 * @description: 添加部门
 */
export function addDept(params) {
  return http.request({
    url: '/dept',
    method: 'post',
    params,
  });
}

/**
 * @description: 编辑部门
 */
export function editDept(params) {
  return http.request({
    url: '/dept',
    method: 'patch',
    params,
  });
}

/**
 * @description: 部门详情
 */
export function deptInfo(id) {
  return http.request({
    url: `/dept/${id}`,
    method: 'get',
  });
}

/**
 * @description: 删除部门
 */
export function deleteDept(id) {
  return http.request({
    url: `/dept/${id}`,
    method: 'delete',
  });
}

/**
 * @description: 拖拽排序部门
 */
export function deptSort(data) {
  return http.request({
    url: '/depts/sort',
    method: 'put',
    data,
  });
}
